package com.msb.test;

import com.msb.dao.impl.EmpDao;
import com.msb.pojo.Emp;
import com.msb.service.impl.EmpService;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.core.SpringVersion;

import java.util.Date;
import java.util.List;

public class test {
    @Test
    public  void testJdbc(){
        String springVersion = SpringVersion.getVersion();
        //String springBootVersion = SpringBootVersion.getVersion();
        System.out.println("Spring版本:"+springVersion);
        System.out.println("test jdbc ...\n");

        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml");
        EmpService empService = applicationContext.getBean(EmpService.class);
        //1.查询员工个数
        //int empCount = empService.findEmpCount();
        //2.根据员工编号查询员工对象
        //Emp emp = empService.findByEmpno(7521);
        //3.根据部门编号查询多个员工对象集合
        //List<Emp> empList = empService.findByDeptno(20);
        //empList.forEach(emp -> {System.out.println(emp);});
        //4.增加员工信息
        //int rows = empService.addEmp(new Emp(7939,"JERRY","MANAGER",7839,new Date(),3000.0,0.0,20));
        //System.out.println(rows);
        //5.根据员工编号删除员工信息
        //int rows = empService.deleteEmp(7939);
        //System.out.println(rows);
        Emp emp;



    }
}
